/* 
 * File:   filme.h
 * Author: fguira
 *
 * Created on 17 de setembro de 2011, 13:33
 */

#ifndef FILME_H
#define	FILME_H
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>

class Filme {
private:
    char key[5];
    std::string portTitle;
    std::string originTitle;
    std::string director;
    char releaseYear[4];
    std::string country;
    char stars;
public:

    std::string getCountry() const;

    std::string getDirector() const;

    char* getKey() const;

    std::string getOriginTitle() const;

    std::string getPortTitle() const;

    char* getReleaseYear() const;

    char getStars() const;
    
    void setStars(char stars);
    
    Filme(std::string port, std::string orig, std::string dir,  std::string ano, std::string pais, char nota);
    

};

class IndicePrimario {
private:
    char key[5];
    int endereco;
public:
    char* getkey() const;
    int getendereco() const;
    IndicePrimario(char* pkey, int r);
};

class IndiceSecundario {
private:
    char key[5];
    std::string portTitle;
    
public:
    char* getkey() const;
    std::string getportTitle() const;
    IndiceSecundario(char* pkey, std::string port);
    
};

void abreArquivos();
void inserirFilme(std::vector<IndicePrimario> *iP, std::vector<IndiceSecundario> *iS);
void maiuscula(std::string & str);
bool registrarArquivo(const Filme *xpto, int &i, std::vector<IndicePrimario> *iP, std::vector<IndiceSecundario> *iS);
void copiaIndicePrimario(std::vector<IndicePrimario> *Indice);
void salvarIndice(std::vector<IndicePrimario> *iP);
void salvaIndiceSec(std::vector<IndiceSecundario> *iS);
void ordenarIndice(std::vector<IndicePrimario> *iP, std::vector<IndiceSecundario> *iS);
#endif	/* FILME_H */

